package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	swaggerfiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	_ "gocode.com/m/docs"
	"gocode.com/m/model"
	"gocode.com/m/router"
)

func main() {
	ginServer := gin.Default()
	// Swagger 配置
	ginServer.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
	// 设置数据库
	model.InitDatabase()
	// 设置路由
	router.SetApiRouter(ginServer)
	// 打印所有的路由
	routers := ginServer.Routes()
	for _, v := range routers {
		fmt.Println(v.Method, v.Path)
	}
	// 监听并在 0.0.0.0:8080 上启动服务
	ginServer.Run(":8081")
}
